<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>入库通知管理</title>
	<meta name="decorator" content="ani"/>
	<style>
		#searchresult
		{
			width: 260px;
			position: absolute;
			z-index: 1;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}
		#searchresult1
		{
			width: 260px;
			position: absolute;
			z-index: 1;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}

		.line
		{
			font-size: 15px;
			background: #E0E0E0;
			width: 140px;
			padding:0px;
		}
		.hover
		{
			background: #007ab8;
			width: 140px;
			color: #fff;
		}
		.std
		{
			width: 150px;
		}
	</style>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/wms/storageInform/save",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
	        $('#receivingDate').datetimepicker({
				 format: "YYYY-MM-DD HH:00"
		    });
	        $('#expectDate').datetimepicker({
				 format: "YYYY-MM-DD HH:00"
		    });
	        $('#arrivalDate').datetimepicker({
				 format: "YYYY-MM-DD HH:00"
		    });
            $('#storageDate').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#dates').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#practicalDate').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
		});
		
		function addRow(list, idx, tpl, row){
			$(list).append(Mustache.render(tpl, {
				idx: idx, delBtn: true, row: row
			}));
			$(list+idx).find("select").each(function(){
				$(this).val($(this).attr("data-value"));
			});
			$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
				var ss = $(this).attr("data-value").split(',');
				for (var i=0; i<ss.length; i++){
					if($(this).val() == ss[i]){
						$(this).attr("checked","checked");
					}
				}
			});
			$(list+idx).find(".form_datetime").each(function(){
				 $(this).datetimepicker({
					 format: "YYYY-MM-DD HH:00"
			    });
			});
		}
		function delRow(obj, prefix){
			var id = $(prefix+"_id");
			var delFlag = $(prefix+"_delFlag");
			if (id.val() == ""){
				$(obj).parent().parent().remove();
			}else if(delFlag.val() == "0"){
				delFlag.val("1");
				$(obj).html("&divide;").attr("title", "撤销删除");
				$(obj).parent().parent().addClass("error");
			}else if(delFlag.val() == "1"){
				delFlag.val("0");
				$(obj).html("&times;").attr("title", "删除");
				$(obj).parent().parent().removeClass("error");
			}
		}
        function show(id,index) {


            $("#hid").val(id);
            $.ajax({
                url: "${ctx}/wms/storageInform/findDetil?i="+id,
                dateType:"json",
                success: function (data) {
                    $("#lineNumber").val(index);
                    $("#storagesNumber").val(data.storageInform.storageNumber);
                    $("#materialCoding").val(data.materialName.code);
                    $("#materialName").val(data.materialName.name);
                    $("#goods").val(data.materialName.id);
                    $("#packaging").val(data.materialName.packingCode);
                    $("#units").val(data.materialName.packing);
                    $("#quantitiesReceiveds").val(parseInt(data.forecast)-parseInt(data.quantitiesReceived));
                    $("#expect").val(data.forecast);
                    var a=parseFloat(data.materialName.volume)*(parseInt(data.forecast)-parseInt(data.quantitiesReceived));
                    $("#volume").val(a.toFixed(5));
                    $("#tj").val(data.materialName.volume);
                    $("#roughWeightss").val((parseFloat(data.materialName.grossWeight)*(parseInt(data.forecast)-parseInt(data.quantitiesReceived))).toFixed(5));
                    $("#mz").val(data.materialName.grossWeight);
                    $("#suttle").val((parseFloat(data.materialName.weight)*(parseInt(data.forecast)-parseInt(data.quantitiesReceived))).toFixed(5));
                    $("#jz").val(data.materialName.weight);
                    $("#lengths").val(data.materialName.length);
                    $("#wide").val(data.materialName.width);
                    $("#tall").val(data.materialName.height);
                    $("#dat").val(data.dates);
                    $("#ownerCode").val(data.storageInform.shipperCode);
                    $("#status").val(data.state);
                    $("#dealNumber").val(data.goodsNumber);
                    $("#alreadyReceive").val(data.quantitiesReceived);
                    $("#remark").val(data.remarks);
                   // $("#storage").val(new Date());
                },
                error: function (data) {
                    alert("操作失败!");
                }
            });


            $("#myModal").modal("show");
        }
function upda(val) {
if(val==""){
    val="0";
}
  var sy= parseInt($("#expect").val())- parseInt($("#alreadyReceive").val()) ;
if(parseInt(val)>sy){
    jp.error("收货数量大于剩余数量！")
	$("#quantitiesReceiveds").val(sy);
    $("#quantitiesReceiveds").onfocus
}
    var a=(parseFloat($("#mz").val())*parseInt(val)).toFixed(5);
    var b=(parseFloat($("#jz").val())*parseInt(val)).toFixed(5);
    var c=(parseFloat($("#tj").val())*parseInt(val)).toFixed(5);
    $("#roughWeightss").val(a);
    $("#suttle").val(b);
    $("#volume").val(c);

}
     function save1() {
		         use();

                 $("#myModal").modal("hide");

     }
     function  use() {
         var storagesNumber= $("#storagesNumber").val();
         var lineNumber= $("#lineNumber").val();
         var dealNumber= $("#dealNumber").val();
         var status= $("#status").val();
         var lpn= $("#lpn").val();
         var cases= $("#cases").val();
         var materialCoding= $("#materialCoding").val();
         var materialName= $("#materialName").val();
         var packaging= $("#packaging").val();
         var units= $("#units").val();
         var quantitiesReceiveds= $("#quantitiesReceiveds").val();
         var expect= $("#expect").val();
         var alreadyReceive= $("#alreadyReceive").val();
         var await= $("#await").val();
         var putawayNumber= $("#putawayNumber").val();
         var allocationNumber= $("#allocationNumber").val();
         var goodsAllocation= $("#goodsAllocation").val();
         var goodsAllocationId= $("#goodsAllocationId").val();
         var codeFreeze= $("#codeFreeze").val();
         var cause= $("#cause").val();
         var storageDate= $("#storage").val();
         var ownerCode= $("#ownerCode").val();
         var supplierCode= $("#supplierCode").val();
         var poNumber= $("#poNumber").val();
         var volume= $("#volume").val();
         var roughWeightss= $("#roughWeightss").val();
         var suttle= $("#suttle").val();
         var lengths= $("#lengths").val();
         var wide= $("#wide").val();
         var tall= $("#tall").val();
         var qualityTesting= $("#qualityTesting").val();
         var adjustment= $("#adjustment").val();
         var badnessCause= $("#badnessCause").val();
         var property= $("#property").val();
         var propertyOne= $("#propertyOne").val();
         var propertyTwo= $("#propertyTwo").val();
         var production= $("#production").val();
         var traceability= $("#traceability").val();
         var dateRemark= $("#dateRemark").val();
         var scan= $("#scan").val();
         var properties= $("#properties").val();
         var dates= $("#dat").val();
         var practicalDate= $("#dd1").val();
         var batch= $("#batch").val();
         var remark= $("#remark").val();
         var hid=$("#hid").val();
         var index=parseInt(lineNumber)-1;
         var goods=$("#goods").val();
         if((parseInt(alreadyReceive)+parseInt(quantitiesReceiveds))>parseInt(expect)){
             alert("收货数量不应大于应收数量");
             return;
		 } if((parseInt(alreadyReceive)+parseInt(quantitiesReceiveds))==parseInt(expect)){
             $("#"+hid).text("收货完成");
             $("#"+index).text(expect);
         $("#sh"+hid).attr("disabled",true);
		 }else{
             $("#"+index).text((parseInt(alreadyReceive)+parseInt(quantitiesReceiveds)));
             $("#"+hid).text("部分收货");
		 }

         $.ajax({
             url: "${ctx}/wms/storageInform/saveStorageInform",
             dateType:"json",
             async: false,
             data:{
                 "goodsAllocationId":goodsAllocationId,
                 "batch":batch,
                 "hid":hid,
                 "goods":goods,
                 "storagesNumber":storagesNumber,
                 "lineNumber":lineNumber,
                 "dealNumber":dealNumber,
                 "status":status,
                 "lpn":lpn,
                 "cases":cases,
                 "materialCoding":materialCoding,
                 "materialName":materialName,
                 "packaging":packaging,
                 "units":units,
                 "quantitiesReceived":quantitiesReceiveds,
                 "expect":expect,
                 "alreadyReceive":alreadyReceive,
                 "await":await,
                 "putawayNumber":putawayNumber,
                 "allocationNumber":allocationNumber,
                 "goodsAllocation":goodsAllocation,
                 "codeFreeze":codeFreeze,
                 "cause":cause,
                 "storageDate":storageDate,
                 "ownerCode":ownerCode,
                 "supplierCode":supplierCode,
                 "poNumber":poNumber,
                 "volume":volume,
                 "roughWeightss":roughWeightss,
                 "suttle":suttle,
                 "lengths":lengths,
                 "wide":wide,
                 "tall":tall,
                 "qualityTesting":qualityTesting,
                 "adjustment":adjustment,
                 "badnessCause":badnessCause,
                 "property":property,
                 "properties":properties,
                 "propertyOne":propertyOne,
                 "propertyTwo":propertyTwo,
                 "production":production,
                 "traceability":traceability,
                 "dateRemark":dateRemark,
                 "scan":scan,
                 "dates":dates,
                 "practicalDate":practicalDate,
                 "remarks":remark,

             },
             success: function (data) {

             },
             error: function (data) {
                 alert("操作失败!");
             }
         });



     }

		 

     function show2() {
             use();
          var id=$("#hid").val();
          var index=$("#lineNumber").val();
//         $("#storagesNumber").val("");
//         $("#lineNumber").val("");
//         $("#dealNumber").val("");
//         $("#status").val("");
//         $("#lpn").val("");
//         $("#cases").val("");
//         $("#materialCoding").val("");
//         $("#materialName").val("");
//         $("#packaging").val("");
//         $("#units").val("");
//         $("#quantitiesReceiveds").val("");
//         $("#expect").val("");
//         $("#alreadyReceive").val("");
//         $("#await").val("");
//         $("#putawayNumber").val("");
//         $("#allocationNumber").val("");
//         $("#goodsAllocation").val("");
//         $("#codeFreeze").val("");
//         $("#cause").val("");
//         $("#storage").val("");
//         $("#ownerCode").val("");
//         $("#supplierCode").val("");
//         $("#poNumber").val("");
//         $("#volume").val("");
//         $("#roughWeightss").val("");
//         $("#suttle").val("");
//         $("#lengths").val("");
//         $("#wide").val("");
//         $("#tall").val("");
//         $("#qualityTesting").val("");
//         $("#adjustment").val("");
//         $("#badnessCause").val("");
//         $("#property").val("");
//         $("#propertyOne").val("");
//         $("#propertyTwo").val("");
//         $("#production").val("");
//         $("#traceability").val("");
//         $("#dateRemark").val("");
//         $("#scan").val("");
//         $("#properties").val("");
//         $("#dat").val("");
//         $("#dd1").val("");
//         $("#batch").val("");
//         $("#remark").val("");
		 show(id,index)
		}

		function tc() {
		    var  id=$("#id").val();
		    $("#dtil").empty();
		    $.ajax({
               url:'${ctx}/wms/receivingNotes/findListByPid?pid='+id,
				success:function (data) {
                    $.each($.parseJSON(data), function (index,term) {
                        var addTr = $("<tr></tr>");
                        addTr.appendTo("#dtil");
                        addTr.append($("<td></td>").text(term.materialCoding));
                        addTr.append($('<td></td>').text(term.materialName));
                        addTr.append($('<td></td>').text(term.goodsAllocation));
                        addTr.append($('<td></td>').text(term.quantitiesReceived));
                        addTr.append($('<td></td>').text(term.packaging));
                        addTr.append($('<td></td>').text(term.units));
                        addTr.append($('<td></td>').text(term.batch));
                        addTr.append($('<td></td>').text(term.remarks));
                    })
                }
			})
        }
        function ee(evt) {
            ChangeCoords1(); //控制查询结果div坐标
            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#goodsAllocation").val() != "" && k != 38 && k != 40 && k != 13) {

                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/location/getLocation?name="+$("#goodsAllocation").val(),
                    //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        alert("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
						/*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line' id='"+item.id+"'><td class='std'>" + item.name+ "</td></tr>";
                            });
                            layer += "</table>";
                            //将结果添加到div中
                            $("#searchresult").empty();
                            $("#searchresult").append(layer);
                            $(".line:first").addClass("hover");
                            $("#searchresult").css("display", "");
                            //鼠标移动事件

                            $(".line").hover(function () {
                                $(".line").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line").click(function () {
                                $("#goodsAllocation").val($(this).text());
                                $('#goodsAllocationId').val($(this).attr("id"));
                                $("#searchresult").css("display", "none");
                            });
                        } else {
                            $("#searchresult").empty();
                            $("#searchresult").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa tr.hover').prev().addClass("hover");
                $('#aa tr.hover').next().removeClass("hover");
                $('#goodsAllocation').val($('#aa tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa tr.hover').next().addClass("hover");
                $('#aa tr.hover').prev().removeClass("hover");
                $('#goodsAllocation').val($('#aa tr.hover').text());

            }
            else if (k == 13) {//回车
                $('#goodsAllocation').val($('#aa tr.hover').text());
                $('#goodsAllocationId').val($('#aa tr.hover').attr("id"));
                $("#searchresult").empty();
                $("#searchresult").css("display", "none");
            }
            else {
                $("#searchresult").empty();
                $("#searchresult").css("display", "none");
            }
        };
        $("#searchresult").bind("mouseleave", function () {
            $("#searchresult").empty();
            $("#searchresult").css("display", "none");
        });



        function ChangeCoords1() {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#goodsAllocation").position().left; //获取距离最左端的距离，像素，整型
            var top = $("#goodsAllocation").position().top + 30; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult").css("top", top + "px"); //同上
        }
        function se(evt) {
            ChangeCoords(); //控制查询结果div坐标
            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#production").val() != "" && k != 38 && k != 40 && k != 13) {
                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/productAddress/getplace?name="+$("#production").val()+"&pro=${fns:getUseroffice()}",   //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        alert("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
                        /*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line' id='"+item.id+"'><td class='std'>" + item.name+ "</td></tr>";
                            });
                            layer += "</table>";

                            //将结果添加到div中
                            $("#searchresult1").empty();
                            $("#searchresult1").append(layer);
                            $(".line:first").addClass("hover");
                            $("#searchresult1").css("display", "");
                            //鼠标移动事件

                            $(".line").hover(function () {
                                $(".line").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line").click(function () {
                                $("#production").val($(this).text());
//                                tc($(this).attr("id"));
                                $("#searchresult1").css("display", "none");
                            });
                        } else {
                            $("#searchresult1").empty();
                            $("#searchresult1").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa tr.hover').prev().addClass("hover");
                $('#aa tr.hover').next().removeClass("hover");
                $('#production').val($('#aa tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa tr.hover').next().addClass("hover");
                $('#aa tr.hover').prev().removeClass("hover");
                $('#production').val($('#aa tr.hover').text());
            }
            else if (k == 13) {//回车
                $('#production').val($('#aa tr.hover').text());
                tc($('#aa tr.hover').attr("id"));
                $("#searchresult1").empty();
                $("#searchresult1").css("display", "none");
            }
            else {
                $("#searchresult1").empty();
                $("#searchresult1").css("display", "none");
            }
        };
        $("#searchresult1").bind("mouseleave", function () {
            $("#searchresult1").empty();
            $("#searchresult1").css("display", "none");
        });
        function ChangeCoords() {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#production").position().left; //获取距离最左端的距离，像素，整型
            var top = $("#production").position().top + 30; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult1").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult1").css("top", top + "px"); //同上
        }

	</script>
</head>
<body class="bg-white">

<form:form id="inputForm" modelAttribute="storageInform" action="${ctx}/wms/storageInform/save" method="post" class="form-horizontal" >
  <form:hidden path="id"/>
    <sys:message content="${message}"/>
<ul class="nav nav-tabs">
	<li class=""><a data-toggle="tab" href="#tab-01" aria-expanded="true">基础信息</a>
	</li>
	<li class="active"><a data-toggle="tab" href="#tab-02" aria-expanded="false">入库通知明细</a>
	</li>
	<li class=""><a data-toggle="tab" href="#tab-03" aria-expanded="false" onclick="tc()">收货明细</a>
	</li>
</ul>

<div class="tab-content">

	<div id="tab-01" class="tab-pane fade ">
		<table class="table table-bordered">
			<tbody>
			<tr>
				<td class="width-15 active"><label class="pull-right">入库通知单号：</label></td>
				<td class="width-35">
					<form:input path="storageNumber" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">货主代码：</label></td>
				<td class="width-35">
					<form:input path="shipperCode" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">项目名称：</label></td>
				<td class="width-35">
					<form:input path="projectName" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">装运单号(货主单号)：</label></td>
				<td class="width-35">
					<form:input path="shippingNumber" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">状态：</label></td>
				<td class="width-35">
					<form:input path="state" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">实际收货日期：</label></td>
				<td class="width-35">
					<div class='input-group form_datetime' id='receivingDate'>
						<input type='text'  name="receivingDate" class="form-control "  value="<fmt:formatDate value="${storageInform.receivingDate}" pattern="yyyy-MM-dd HH:00"/>"/>
						<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
					</div>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">入库类型：</label></td>
				<td class="width-35">
					<form:select path="storageType" class="form-control ">
						<form:options items="${fns:getDictList('storage_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
				<td class="width-15 active"><label class="pull-right">总预期量：</label></td>
				<td class="width-35">
					<form:input path="forecast" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">总接收量：</label></td>
				<td class="width-35">
					<form:input path="quantitiesReceived" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">预期到货日期：</label></td>
				<td class="width-35">
					<div class='input-group form_datetime' id='expectDate'>
						<input type='text'  name="expectDate" class="form-control "  value="<fmt:formatDate value="${storageInform.expectDate}" pattern="yyyy-MM-dd HH:00"/>"/>
						<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
					</div>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">到货日期：</label></td>
				<td class="width-35">
					<div class='input-group form_datetime' id='arrivalDate'>
						<input type='text'  name="arrivalDate" class="form-control "  value="<fmt:formatDate value="${storageInform.arrivalDate}" pattern="yyyy-MM-dd HH:00"/>"/>
						<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
					</div>
				</td>
				<td class="width-15 active"><label class="pull-right">总毛重：</label></td>
				<td class="width-35">
					<form:input path="roughWeight" htmlEscape="false"  readonly="true"   class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">总体积：</label></td>
				<td class="width-35">
					<form:input path="totalVolume" htmlEscape="false"  readonly="true"   class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">产地：</label></td>
				<td class="width-35">
					<form:input path="productionPlace" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">产地代码：</label></td>
				<td class="width-35">
					<form:input path="originCode" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">交货单号：</label></td>
				<td class="width-35">
					<form:input path="deliveryNumber" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">物流商名称：</label></td>
				<td class="width-35">
					<form:input path="providerName" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">联系人：</label></td>
				<td class="width-35">
					<form:input path="name" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">联系人电话：</label></td>
				<td class="width-35">
					<form:input path="phone" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">车牌号码：</label></td>
				<td class="width-35">
					<form:input path="number" htmlEscape="false"    class="form-control required"/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">司机电话：</label></td>
				<td class="width-35">
					<form:input path="driverPhone" htmlEscape="false"    class="form-control required"/>
				</td>
				<td class="width-15 active"><label class="pull-right">运输方式：</label></td>
				<td class="width-35">
					<form:input path="transportationWay" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">司机姓名：</label></td>
				<td class="width-35">
					<form:input path="driverName" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">货主名称：</label></td>
				<td class="width-35">
					<form:input path="ownerName" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">地址：</label></td>
				<td class="width-35">
					<form:input path="site" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">货主联系人：</label></td>
				<td class="width-35">
					<form:input path="ownerContacts" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">货主电话：</label></td>
				<td class="width-35">
					<form:input path="ownerPhone" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">物流订单号：</label></td>
				<td class="width-35">
					<form:input path="logisticsBumber" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">货主系统名称：</label></td>
				<td class="width-35">
					<form:input path="systemName" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
				<td class="width-35">
					<form:input path="remarks" htmlEscape="false"    class="form-control "/>
				</td>
			</tr>
			</tbody>
		</table>

	</div>
	<div id="tab-02" class="tab-pane fade in  active">
			<div class="tabs-container">
				<input type="hidden" id="hid"/>
		<table class="table table-striped table-bordered table-condensed">
			<thead>
			<tr>

				<th>状态</th>
				<th>操作</th>
				<th>物料编码</th>
				<th>物料名称</th>
				<th>预期量</th>
				<th>已接收量</th>
				<th>提货仓库</th>
				<th>物料规格</th>
				<th>包装单位</th>
				<th>毛重(吨)</th>
				<th>体积(M3)</th>
				<th>交货单号</th>
			</tr>
			<c:forEach items="${storageInform.materialParticularsList}" var="map" varStatus="index">
				<tr>
					<th id="${map.id}">${map.state}</th>
					<th> <input id="sh${map.id}" type="button" <c:if test="${map.state=='收货完成'}">disabled="disabled"</c:if>  class="btn btn-danger"   value="收货"  onclick="show('${map.id}','${index.index+1}')"  />
					</th>
					<th>${map.materialCode}</th>
					<th>${map.materialName.name}</th>
					<th>${map.forecast}</th>
					<th id="${index.index}">${map.quantitiesReceived}</th>
					<th>${map.warehouse}</th>
					<th>${map.materialSpecification}</th>
					<th>${map.packingUnit}</th>
					<th>${map.roughWeight}</th>
					<th>${map.volume}</th>
					<th>${map.goodsNumber}</th>

				</tr>
			</c:forEach>
			</thead>
		</table>
				<div style="height: 50px"></div>

				<div class="tabs-container" <c:if test="${storageInform.state!='收货完成'}">hidden="hidden"  </c:if>>

					<table class="table table-striped table-bordered table-condensed">
						<tr>
							<th>收货数量</th>
							<th>${storageInform.forecast}</th>
							<th>总毛重</th>
							<th>${storageInform.roughWeight}</th>
							<th>吨罐</th>
							<th>${storageInform.dg}</th>
							<th>吨箱</th>
							<th>${storageInform.dx}</th>
							<th>小黄桶</th>
							<th>${storageInform.xht}</th>
							<th>小箱</th>
							<th>${storageInform.xx}</th>
							<th>小桶</th>
							<th>${storageInform.xt}</th>
							<th>中桶</th>
							<th>${storageInform.zt}</th>
							<th>大桶</th>
							<th>${storageInform.dt}</th>
							<th>袋</th>
							<th>${storageInform.dai}</th>
							<th>件</th>
							<th>${storageInform.jian}</th>
						</tr>
					</table>
					<ul class="nav nav-tabs">
						<li class="active"><a data-toggle="tab" href="#tab-2" aria-expanded="true">工作量统计：</a>
						</li>

					</ul>
					<div id="tab-2" class="tab-pane fade  in  active" >
						<a class="btn btn-white btn-sm" onclick="addRow('#statisticsList', statisticsRowIdx, statisticsTpl);statisticsRowIdx = statisticsRowIdx + 1;" title="新增"><i class="fa fa-plus"></i> 新增</a>
						<table class="table table-striped table-bordered table-condensed">
							<thead>
							<tr>
								<th class="hide"></th>
								<th width="15%">职位</th>
								<th width="15%">姓名</th>
								<th>吨罐</th>
								<th>吨箱</th>
								<th>小黄桶</th>
								<th>小箱</th>
								<th>小桶</th>
								<th>中桶</th>
								<th>大桶</th>
								<th>袋</th>
								<th>件</th>
								<th width="10%">备注信息</th>
								<th width="10">&nbsp;</th>
							</tr>
							</thead>
							<tbody id="statisticsList">
							</tbody>
						</table>
						<script type="text/template" id="statisticsTpl">//<!--
				<tr id="statisticsList{{idx}}">
					<td class="hide">
						<input id="statisticsList{{idx}}_id" name="statisticsList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
						<input id="statisticsList{{idx}}_delFlag" name="statisticsList[{{idx}}].delFlag" type="hidden" value="0"/>
					</td>

					<td>
<sys:gridselect url="${ctx}/infor/position/data" id="statisticsList{{idx}}_position" name="statisticsList[{{idx}}].position.id" value="{{row.position.id}}" labelName="statisticsList[{{idx}}].position.name" labelValue="{{row.position.name}}"
							title="选择职位" cssClass="form-control  " fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name" ></sys:gridselect>					</td>


					<td>
					<sys:gridselect url="${ctx}/infor/staff/data" id="statisticsList{{idx}}_name" name="statisticsList[{{idx}}].name.id" value="{{row.name.id}}" labelName="statisticsList[{{idx}}].name.name" labelValue="{{row.name.name}}"
							title="选择职位" cssClass="form-control  " fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name" ></sys:gridselect>					</td>

					</td>
					<td>
							<input id="outStatisticsList{{idx}}_dg" name="outStatisticsList[{{idx}}].dg" type="text" value="{{row.dg}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_dx" name="outStatisticsList[{{idx}}].dx" type="text" value="{{row.dx}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_xht" name="outStatisticsList[{{idx}}].xht" type="text" value="{{row.xht}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_xx" name="outStatisticsList[{{idx}}].xx" type="text" value="{{row.xx}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_xt" name="outStatisticsList[{{idx}}].xt" type="text" value="{{row.xt}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_zt" name="outStatisticsList[{{idx}}].zt" type="text" value="{{row.zt}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_dt" name="outStatisticsList[{{idx}}].dt" type="text" value="{{row.dt}}"    class="form-control "/>
							</td>
<td>
							<input id="outStatisticsList{{idx}}_dai" name="outStatisticsList[{{idx}}].dai" type="text" value="{{row.dai}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_jian" name="outStatisticsList[{{idx}}].jian" type="text" value="{{row.jian}}"    class="form-control "/>
							</td>



					<td>
						<input id="statisticsList{{idx}}_remarks" name="statisticsList[{{idx}}].remarks"  type="text"  value="{{row.remarks}}" class="form-control "/>
					</td>

					<td class="text-center" width="10">
						{{#delBtn}}<span class="close" onclick="delRow(this, '#statisticsList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
					</td>
				</tr>//-->
						</script>
						<script type="text/javascript">
                            var statisticsRowIdx = 0, statisticsTpl = $("#statisticsTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
                            $(document).ready(function() {
                                var data = ${fns:toJson(storageInform.statisticsList)};
                                for (var i=0; i<data.length; i++){
                                    addRow('#statisticsList', statisticsRowIdx, statisticsTpl, data[i]);
                                    statisticsRowIdx = statisticsRowIdx + 1;
                                }
                            });
						</script>
					</div>
				</div>
			</div>
	</div>
	<div id="tab-03" class="tab-pane fade">
		<div class="tabs-container">
			<table class="table table-striped table-bordered table-condensed">
               <thead>
			   <tr>
				   <th>物料编码</th>
				   <th>物料名称</th>
				   <th>货位</th>
				   <th>接收量</th>
				   <th>包装</th>
				   <th>计量单位</th>
				   <th>批次</th>
				   <th>备注</th>
			   </tr></thead>
				<tbody id="dtil">

				</tbody>
			</table>
		</div>
	</div>


</div>
</form:form>
<input type="hidden" id="goods"/>
<input type="hidden" id="mz"/>
<input type="hidden" id="jz"/>
<input type="hidden" id="tj"/>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
	<div class="modal-dialog" style="width: 1400px;height: 1000px"  >
		<div class="modal-content" >
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myCloseModalLabel">收货页面</h4>
			</div>
			<div class="modal-body"  >
				<input  type="button" value="保存" onclick="save1()" class="btn btn-danger"/>
				<input  type="button" value="保存并继续" onclick="show2()" class="btn btn-success"/>
				<table class="table table-bordered" >
					<tbody >




					<tr>

							<%--<td class="width-7 active"><label class="pull-right">入库单号：</label></td>--%>
							<%--<td class="width-18">--%>
								<%--<input id="storagesNumber"  name="storagesNumber" type="text"    class="form-control "/>--%>
							<%--</td>--%>
							<%--<td class="width-7 active"><label class="pull-right">状态：</label></td>--%>
							<%--<td class="width-18">--%>
								<%--<input id="status" name="status"   type="text"   class="form-control "/>--%>
							<%--</td>--%>
						<td class="width-7 active"><label class="pull-right">物料编码：</label></td>
						<td class="width-18">
							<input id="materialCoding"   name="materialCoding" type="text"  class="form-control "/>
						</td>
						<td class="width-7 active"><label class="pull-right">物料名称：</label></td>
						<td class="width-18">
							<input id="materialName"   name="materialName"  type="text"  class="form-control "/>
						</td>
								<td class="width-7 active"><label class="pull-right">预期量：</label></td>
								<td class="width-18">
									<input id="expect"   name="expect" type="text"  class="form-control "/>
								</td>
					</tr>
					<tr>

						<td class="width-7 active"><label class="pull-right">接收量：</label></td>
						<td class="width-18">
							<input id="quantitiesReceiveds"  name="quantitiesReceiveds" type="text" onblur="upda(this.value)"  class="form-control "/>
						</td>
						<td class="width-7 active"><label class="pull-right">货位：</label></td>
						<td class="width-18">
							<input id="goodsAllocation" autocomplete="off"  name="goodsAllocation"  onkeyup="ee(event)"  type="text"  class="form-control "/>
							<input id="goodsAllocationId"   name="goodsAllocationId"  onkeyup="ee(event)"  type="hidden"  class="form-control "/>
							<div id="searchresult" style="display: none;"></div>
						</td>
						<td class="width-7 active"><label class="pull-right">已接收量：</label></td>
						<td class="width-18">
							<input id="alreadyReceive" name="alreadyReceive"   type="text"  class="form-control "/>
						</td>

					</tr>
					<tr>
						<td class="width-7 active"><label class="pull-right">入库日期：</label></td>
						<td class="width-18">
							<div class='input-group form_datetime' id='storageDate'>
								<input type='text'  id="storage" name="storageDate" class="form-control"  value="<fmt:formatDate value="${receivingNotes.storageDate}" pattern="yyyy-MM-dd HH:00"/>"/>
								<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
							</div>
						</td>
						<td class="width-7 active"><label class="pull-right">包装：</label></td>
						<td class="width-18">
							<input id="packaging"   name="packaging"  type="text"  class="form-control "/>
						</td>
						<td class="width-7 active"><label class="pull-right">计量单位：</label></td>
						<td class="width-18">
							<input id="units"   name="units"   type="text"  class="form-control "/>
						</td>




					</tr>






					<tr>
						<td class="width-7 active"><label class="pull-right">货主代码：</label></td>
						<td class="width-18">
							<input id="ownerCode"  name="ownerCode" type="text"   class="form-control "/>
						</td>
						<td class="width-7 active"><label class="pull-right">体积(M3)：</label></td>
						<td class="width-18">
							<input id="volume"   name="volume" type="text"  class="form-control "/>
						</td>
						<td class="width-7 active"><label class="pull-right">毛重(吨)：</label></td>
						<td class="width-18">
							<input id="roughWeightss"   name="roughWeightss" type="text"  class="form-control "/>
						</td>


					</tr>

<tr><td class="width-7 active"><label class="pull-right">净重(KG)：</label></td>
	<td class="width-18">
		<input id="suttle"  name="suttle"  type="text" class="form-control "/>
	</td>
	<td class="width-7 active"><label class="pull-right">产地：</label></td>
	<td class="width-18">
		<input id="production"  name="production"  htmlEscape="false" onkeyup="se(event)"   class="form-control "/>
		<div id="searchresult1" style="display: none;"></div>

	</td>
	<td class="width-7 active"><label class="pull-right">追溯信息：</label></td>
	<td class="width-18">
		<input id="traceability"   name="traceability" type="text"    class="form-control "/>
	</td>
</tr>


					<tr>
						<td class="width-7 active"><label class="pull-right">生产日期：</label></td>
						<td class="width-18">

							<div class='input-group form_datetime' id='dates'>
								<input type='text' id="dat"  name="dates" class="form-control"  value="<fmt:formatDate value="${receivingNotes.dates}" pattern="yyyy-MM-dd HH:00"/>"/>
								<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
							</div>

						</td>
						<td class="width-7 active"><label class="pull-right">生产日期备注：</label></td>
						<td class="width-18">
							<input id="dateRemark"  name="dateRemark" type="text"    class="form-control "/>
						</td>

						<td class="width-7 active"><label class="pull-right">是否扫描：</label></td>
						<td class="width-18">
							<select name="scan" id="scan" class="form-control ">
								<option value="否">否</option>
								<option value="是">是</option>
							</select>


						</td>


					</tr>
					<tr>


						<td class="width-7 active"><label class="pull-right">实际到货日期：</label></td>
						<td class="width-18">

							<div class='input-group form_datetime' id='practicalDate'>
								<input type='text' id="dd1" name="practicalDate" class="form-control"  value="<fmt:formatDate value="${receivingNotes.practicalDate}" pattern="yyyy-MM-dd HH:00"/>"/>
								<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
							</div>
						</td>
						<td class="width-7 active"><label class="pull-right">批次：</label></td>
						<td class="width-18">
							<input id="batch"   name="batch" type="text"    class="form-control "/>
						</td>

						<td class="width-7 active"><label class="pull-right">备注信息：</label></td>
						<td class="width-18">
							<input id="remark"    name="remark"  type="text"   class="form-control "/>
						</td>
					</tr>
					</tbody>
				</table>
				<%--<td class="width-7 active"><label class="pull-right">行号：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="lineNumber"  name="lineNumber" type="text"   class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">交易号：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="dealNumber"  name="dealNumber" type="text"    class="form-control "/>--%>
				<%--</td>--%>

			<%--<td class="width-7 active"><label class="pull-right">LPN号：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="lpn"   name="lpn"  type="text"   class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">箱号：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="cases"   name="cases" type="text"  class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">PO号：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="poNumber"   name="poNumber"    type="text"    class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">长(M)：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="lengths"  name="lengths"  type="text"  class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">宽(M)：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="wide"    name="wide"  type="text"  class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">高(M)：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="tall"    name="tall"   type="text"   class="form-control"/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">需要质检：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input type="text"   id="qualityTesting" name="qualityTesting"  class="form-control"  />--%>


				<%--</td>--%>

				<%--<td class="width-7 active"><label class="pull-right">质检自动调整：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="adjustment" name="adjustment"  type="text"    class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">不良原因：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="badnessCause"  name="badnessCause"  type="text"   class="form-control "/>--%>
				<%--</td>--%>


				<%--<td class="width-7 active"><label class="pull-right">批属性：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="property"   name="property" type="text"    class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">批属性01：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="propertyOne"   name="propertyOne" type="text"   class="form-control "/>--%>
				<%--</td>--%>

				<%--<td class="width-7 active"><label class="pull-right">批属性02：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="propertyTwo"  name="propertyTwo" type="text"    class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">货品属性：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="properties"  name="properties" type="text"    class="form-control "/>--%>
				<%--</td>--%>
				<%--<td class="width-7 active"><label class="pull-right">冻结代码：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="codeFreeze" name="codeFreeze"  type="text"   class="form-control "/>--%>
				<%--</td>--%>

				<%--<td class="width-7 active"><label class="pull-right">原因代码：</label></td>--%>
				<%--<td class="width-18">--%>
				<%--<input id="cause"   name="cause" type="text" class="form-control "/>--%>
				<%--</td>--%>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>


</body>
</html>